package org.wu.framework.log.platform.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.log.platform.application.RunLogApplication;
import org.wu.framework.log.platform.application.command.run.log.*;
import org.wu.framework.log.platform.application.dto.RunLogDTO;
import org.wu.framework.log.platform.domain.model.run.log.RunLog;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;
/**
 * describe 运行日志 
 *
 * @author Jia wei Wu
 * @date 2024/03/24 01:02 下午
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "运行日志提供者")
@EasyController("/run/log")
public class RunLogProvider  {

    @Resource
    private RunLogApplication runLogApplication;

    /**
     * describe 新增运行日志
     *
     * @param runLogStoryCommand 新增运行日志     
     * @return {@link Result<RunLog>} 运行日志新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "新增运行日志")
    @PostMapping("/story")
    public Result<RunLog> story(@RequestBody RunLogStoryCommand runLogStoryCommand){
        return runLogApplication.story(runLogStoryCommand);
    }
    /**
     * describe 批量新增运行日志
     *
     * @param runLogStoryCommandList 批量新增运行日志     
     * @return {@link Result<List<RunLog>>} 运行日志新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "批量新增运行日志")
    @PostMapping("/batchStory")
    public Result<List<RunLog>> batchStory(@RequestBody List<RunLogStoryCommand> runLogStoryCommandList){
        return runLogApplication.batchStory(runLogStoryCommandList);
    }
    /**
     * describe 更新运行日志
     *
     * @param runLogUpdateCommand 更新运行日志     
     * @return {@link Result<RunLog>} 运行日志领域对象     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "更新运行日志")
    @PutMapping("/updateOne")
    public Result<RunLog> updateOne(@RequestBody RunLogUpdateCommand runLogUpdateCommand){
        return runLogApplication.updateOne(runLogUpdateCommand);
    }
    /**
     * describe 查询单个运行日志
     *
     * @param runLogQueryOneCommand 查询单个运行日志     
     * @return {@link Result<RunLogDTO>} 运行日志DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "查询单个运行日志")
    @GetMapping("/findOne")
    public Result<RunLogDTO> findOne(@ModelAttribute RunLogQueryOneCommand runLogQueryOneCommand){
        return runLogApplication.findOne(runLogQueryOneCommand);
    }
    /**
     * describe 查询多个运行日志
     *
     * @param runLogQueryListCommand 查询多个运行日志     
     * @return {@link Result<List<RunLogDTO>>} 运行日志DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "查询多个运行日志")
    @GetMapping("/findList")
    public Result<List<RunLogDTO>> findList(@ModelAttribute RunLogQueryListCommand runLogQueryListCommand){
        return runLogApplication.findList(runLogQueryListCommand);
    }
    /**
     * describe 分页查询多个运行日志
     *
     * @param runLogQueryListCommand 分页查询多个运行日志     
     * @return {@link Result<LazyPage<RunLogDTO>>} 分页运行日志DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "分页查询多个运行日志")
    @GetMapping("/findPage")
    public Result<LazyPage<RunLogDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute RunLogQueryListCommand runLogQueryListCommand){
        return runLogApplication.findPage(size,current,runLogQueryListCommand);
    }
    /**
     * describe 删除运行日志
     *
     * @param runLogRemoveCommand 删除运行日志     
     * @return {@link Result<RunLog>} 运行日志     
     
     * @author Jia wei Wu
     * @date 2024/03/24 01:02 下午
     **/

    @Operation(summary = "删除运行日志")
    @DeleteMapping("/remove")
    public Result<RunLog> remove(@ModelAttribute RunLogRemoveCommand runLogRemoveCommand){
        return runLogApplication.remove(runLogRemoveCommand);
    }
}